//
//  UnderLineLabel.m
//  WangLottery
//
//  Created by 黄修勇 on 12-5-16.
//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//

#import "UnderLineLabel.h"

@implementation UnderLineLabel

-(void)dealloc{


    [super dealloc];
}


- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
    }
    return self;
}

-(void)setText:(NSString *)text{

    [super setText:text];
    [self sizeToFit];
    [self setNeedsDisplay];
}


-(void)setTextColor:(UIColor *)textColor{

    [super setTextColor:textColor];
    [self setNeedsDisplay];
}

// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
    // Drawing code
    
    [super drawRect:rect];
    
    CGContextRef context=UIGraphicsGetCurrentContext();
    CGContextSaveGState(context);
    CGContextSetFillColorWithColor(context, self.textColor.CGColor);
    CGContextMoveToPoint(context, 0.0f, rect.size.height);
    CGContextAddLineToPoint(context, rect.size.width, rect.size.height);
    CGContextClosePath(context);
    CGContextStrokePath(context);
    CGContextRestoreGState(context);
}


@end
